<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <!-- 检查两个⽇期是否相差⼀个⼩时 -->
    <script>
        var date1 = new Date('2022-10-23 14:00:00');
        var date2 = new Date('2022-10-24 13:00:00');
        var time = (date1-date2) / 1000;
        var flie = parseInt(time / 3600) % 24;
        if(flie==1){
            alert('两个日期之间不差一小时');
        }else{
            alert('两个日期相差一小时');
        }
    </script>
</body>
</html>